/*
 * Main Activity
 */

package com.geodroid;


import android.app.Activity;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;

public class GeoDroidActivity extends Activity {
	
	private static final String TAG = "GeoDroidActivity";
	
	GeoView geov ; 
	 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        
    	super.onCreate(savedInstanceState);
//    	
    	Log.d(TAG,"<OnCreate>") ;
    	DisplayMetrics dm = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);
        String str_ScreenSize = "The Android Screen is: "
                    + dm.widthPixels
                    + " x "
                    + dm.heightPixels
                    + "d="
                    + dm.density ;
    
        Log.d("GeoDroidActivity",str_ScreenSize) ;
    	
    	//geov = new GeoView(this) ;
        setContentView(R.layout.main);
        geov = (GeoView) findViewById(R.id.surfaceView) ;
        Log.d(TAG,"<paint>") ;
        geov.paint() ;
        Log.d(TAG,"</paint>") ;
        Log.d(TAG,"</OnCreate>") ;
    }
    
    @Override
    protected void onResume() {
     // TODO Auto-generated method stub
     super.onResume();
     geov.onResumeMySurfaceView();
    }
    
    @Override
    protected void onPause() {
     // TODO Auto-generated method stub
     super.onPause();
     geov.onPauseMySurfaceView();
    }
    
    public void scroll(View gv){
    	Log.d(TAG,"<newPoint>") ;
    	geov.scrollView() ;
    	Log.d(TAG,"</newPoint>") ;
    }
    
    public void newPoint(View gv){
    	Log.d(TAG,"<newPoint>") ;
    	geov.newPoint() ;
    	Log.d(TAG,"</newPoint>") ;
    }
    public void movePoint(View gv){
    	Log.d(TAG,"<movePoint>") ;
    	geov.movePoint() ;
    	Log.d(TAG,"</movePoint>") ;
    }
    
    public void middle(View gv){
    	Log.d(TAG,"<middlePoints>") ;
    	geov.middle() ;
    	Log.d(TAG,"</middlePoint>") ;
    }
    
    public void segment(View gv){
    	Log.d(TAG,"<middlePoints>") ;
    	geov.segment() ;
    	Log.d(TAG,"</middlePoint>") ;
    }
    public void scalePlus(View gv){
    	Log.d(TAG,"<scalePlus>") ;
    	geov.scalePlus() ;
    	Log.d(TAG,"</scalePlus>") ;
    }
    public void scaleMoins(View gv){
    	Log.d(TAG,"<scalePlus>") ;
    	geov.scaleMoins() ;
    	Log.d(TAG,"</scalePlus>") ;
    }
    public void intersect(View gv){
    	Log.d(TAG,"<scalePlus>") ;
    	geov.intersect() ;
    	Log.d(TAG,"</scalePlus>") ;
    }
    public void showHide(View gv){
    	LinearLayout ll=(LinearLayout)findViewById(R.id.Menu);
    	switch(ll.getVisibility()){
    		case View.GONE : ll.setVisibility(View.VISIBLE) ;
    			break ; 
    		case View.VISIBLE : ll.setVisibility(View.GONE); 
    		 	break ;
    		 default :  
    	}
    	this.scroll(gv) ;
    }
    
}